<template>
        <div id="test">
            <button @click="dianji">按钮</button>
            <button @click="haha">会员列表数据</button>
            <button @click="tianqi">获取天气</button>
            <div id="box">

            </div>
            
        </div>
</template>
<script>
import {getlist, getmember, getweather} from "../../src/request/index.js"

export default {
    data(){
        return{

        }
    },
    methods:{
        haha(){
            console.log(111);
            getmember().then(res=>{
                console.log(res.data);
            })
        },
        dianji(){
          let data={
            username:"admin",
            password:"123456"
          }
        getlist(data).then(res=>{
            console.log(res.data);
        })

          
        },
        tianqi(){
            //高德api天气
          fetch("https://restapi.amap.com/v3/weather/weatherInfo?city=110112&key=285178b454905e24abeaad1f7ef5b92e",{
            method:"get",
            "Access-Control-Allow-Origin" : "*",
            "Access-Control-Allow-Credentials" : true,
            headers: {
             'Content-Type': 'application/json'
            },
          }).then(res=>{
            //   console.log(res);
            res.json().then(data=>{
                console.log(data);

            })
          })      
        }
    }
}
</script>
<style scoped>
#box{
    width: 2rem;
    height: 2rem;
    background-color:black;
}
</style>